package structure

import (
	"encoding/hex"
	"fmt"
	"gitee.com/hot-wallet/parent-go/util"
	"github.com/ethereum/go-ethereum/crypto"
	"strings"
)

func GenerateAccountEVM() {
	var i = 1000
	for 0 < i {
		var privateKey, err = crypto.GenerateKey()
		if nil != err {
			//log 报警
			return
		}

		var privateKeyHex = hex.EncodeToString(crypto.FromECDSA(privateKey))
		var addressHex = strings.ToLower(crypto.PubkeyToAddress(privateKey.PublicKey).Hex())

		fmt.Println(i)
		fmt.Println(privateKeyHex)
		fmt.Println(addressHex)

		GenerateAccountEVM33(privateKeyHex)

		i--
	}
}

func GenerateAccountEVM33(uid string) {
	fmt.Println(uid)
	var privateKey, err = crypto.HexToECDSA(uid)
	if nil != err {
		//log 报警
		return
	}

	var privateKeyHex = hex.EncodeToString(crypto.FromECDSA(privateKey))
	var addressHex = strings.ToLower(crypto.PubkeyToAddress(privateKey.PublicKey).Hex())

	fmt.Println(privateKeyHex)
	fmt.Println(addressHex)

	fmt.Println(util.Digest(nil))
}
